import odoo from '@/odoo'

const model = 'hr.payslip'
const namespace = 'hrPayslip'

const fields_default = {
  line_ids:{},
  worked_days_line_ids: {},
  input_line_ids: {},
}

const dvamodel = odoo.dvamodel({
  model,
  fields: fields_default,
})

const { effects } = dvamodel

//console.log(effects)

export default {
  namespace,
  ...dvamodel,
  effects: {
    ...effects,

    *compute({payload}, { call, put }) {
      yield put({ type: 'compute_sheet', payload });
    },

    *post({payload}, { call, put }) {
      yield put({ type: 'action_payslip_done', payload });
    },

    *unpost({payload}, { call, put }) {
      yield put({ type: 'action_payslip_draft', payload });
    },

  }
};

